import os

from PyQt6.QtCore import QUrl
from PyQt6.QtGui import QDesktopServices


def openUrl(url: str):
    if not url.startswith("http"):
        if not os.path.exists(url):
            return False

        QDesktopServices.openUrl(QUrl.fromLocalFile(url))
    else:
        QDesktopServices.openUrl(QUrl(url))

    return True
